<!doctype html>
<html lang="en">
 <head> 
  <meta charset="UTF-8"> 
  <meta name="description" content="燎火的个人博客"> 
  <meta name="keyword" content="燎火,qq799378666,软件开发,java,c#,js,html,html5,css"> 
  <title>Hibernate 参数设置一览表</title> 
  <script src="/js/jquery-1.11.1.min.js"></script> 
  <script src="/js/bootstrap-3.3.5/js/bootstrap.js"></script> 
  <link href="/js/bootstrap-3.3.5/css/bootstrap.css" rel="stylesheet"> 
  <script src="/js/base.js"></script> 
  <script src="/js/nav.js"></script> 
  <script src="/js/jquery.toTop.min.js"></script> 
  <link href="/style/article.css" rel="stylesheet"> 
 </head> 
 <body> 
  <div id="main"> 
   <h3 id="title">Hibernate 参数设置一览表</h3> 
   <div id="content">
    <p><a href="http://www.blogjava.net/i369/articles/194855.html" style="color: rgb(0, 0, 0)">Hibernate 参数设置一览表</a></p>
    <table>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.dialect</span></tt></td>
       <td style="font-size: 12px">一个Hibernate&nbsp;<tt><span style="font-family:新宋体">Dialect</span></tt>类名允许Hibernate针对特定的关系数据库生成优化的SQL.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">full.classname.of.Dialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.show_sql</span></tt></td>
       <td style="font-size: 12px">输出所有SQL语句到控制台. 有一个另外的选择是把<tt><span style="font-family:新宋体">org.hibernate.SQL</span></tt>这个log category设为<tt><span style="font-family:新宋体">debug</span></tt>。&nbsp;eg.&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.format_sql</span></tt></td>
       <td style="font-size: 12px">在log和console中打印出更漂亮的SQL。&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.default_schema</span></tt></td>
       <td style="font-size: 12px">在生成的SQL中, 将给定的schema/tablespace附加于非全限定名的表名上.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">SCHEMA_NAME</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.default_catalog</span></tt></td>
       <td style="font-size: 12px">在生成的SQL中, 将给定的catalog附加于非全限定名的表名上.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">CATALOG_NAME</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.session_factory_name</span></tt></td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">SessionFactory</span></tt>创建后，将自动使用这个名字绑定到JNDI中.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">jndi/composite/name</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.max_fetch_depth</span></tt></td>
       <td style="font-size: 12px">为单向关联(一对一, 多对一)的外连接抓取（outer join fetch）树设置最大深度. 值为<tt><span style="font-family:新宋体">0</span></tt>意味着将关闭默认的外连接抓取.&nbsp;取值&nbsp;建议在<tt><span style="font-family:新宋体">0</span></tt>到<tt><span style="font-family:新宋体">3</span></tt>之间取值</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.default_batch_fetch_size</span></tt></td>
       <td style="font-size: 12px">为Hibernate关联的批量抓取设置默认数量.&nbsp;取值&nbsp;建议的取值为<tt><span style="font-family:新宋体">4</span></tt>,&nbsp;<tt><span style="font-family:新宋体">8</span></tt>, 和<tt><span style="font-family:新宋体">16</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.default_entity_mode</span></tt></td>
       <td style="font-size: 12px">为由这个<tt><span style="font-family:新宋体">SessionFactory</span></tt>打开的所有Session指定默认的实体表现模式.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">dynamic-map</span></tt>,&nbsp;<tt><span style="font-family:新宋体">dom4j</span></tt>,&nbsp;<tt><span style="font-family:新宋体">pojo</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.order_updates</span></tt></td>
       <td style="font-size: 12px">强制Hibernate按照被更新数据的主键，为SQL更新排序。这么做将减少在高并发系统中事务的死锁。&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.generate_statistics</span></tt></td>
       <td style="font-size: 12px">如果开启, Hibernate将收集有助于性能调节的统计数据.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.use_identifer_rollback</span></tt></td>
       <td style="font-size: 12px">如果开启, 在对象被删除时生成的标识属性将被重设为默认值.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.use_sql_comments</span></tt></td>
       <td style="font-size: 12px">如果开启, Hibernate将在SQL中生成有助于调试的注释信息, 默认值为<tt><span style="font-family:新宋体">false</span></tt>.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
     </tbody>
    </table>
    <p><a></a></p>
    <p><strong>表&nbsp;3.4.&nbsp; Hibernate JDBC和连接(connection)属性</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.fetch_size</span></tt></td>
       <td style="font-size: 12px">非零值，指定JDBC抓取数量的大小 (调用<tt><span style="font-family:新宋体">Statement.setFetchSize()</span></tt>).</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.batch_size</span></tt></td>
       <td style="font-size: 12px">非零值，允许Hibernate使用JDBC2的批量更新.&nbsp;取值&nbsp;建议取<tt><span style="font-family:新宋体">5</span></tt>到<tt><span style="font-family:新宋体">30</span></tt>之间的值</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.batch_versioned_data</span></tt></td>
       <td style="font-size: 12px">如果你想让你的JDBC驱动从<tt><span style="font-family:新宋体">executeBatch()</span></tt>返回正确的行计数 , 那么将此属性设为<tt><span style="font-family:新宋体">true</span></tt>(开启这个选项通常是安全的). 同时，Hibernate将为自动版本化的数据使用批量DML. 默认值为<tt><span style="font-family:新宋体">false</span></tt>.&nbsp;eg.&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.factory_class</span></tt></td>
       <td style="font-size: 12px">选择一个自定义的<tt><span style="font-family:新宋体">Batcher</span></tt>. 多数应用程序不需要这个配置属性.&nbsp;eg.&nbsp;<tt><span style="font-family:新宋体">classname.of.Batcher</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.use_scrollable_resultset</span></tt></td>
       <td style="font-size: 12px">允许Hibernate使用JDBC2的可滚动结果集. 只有在使用用户提供的JDBC连接时，这个选项才是必要的, 否则Hibernate会使用连接的元数据.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.use_streams_for_binary</span></tt></td>
       <td style="font-size: 12px">在JDBC读写<tt><span style="font-family:新宋体">binary (二进制)</span></tt>或<tt><span style="font-family:新宋体">serializable (可序列化)</span></tt>&nbsp;的类型时使用流(stream)(系统级属性).&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jdbc.use_get_generated_keys</span></tt></td>
       <td style="font-size: 12px">在数据插入数据库之后，允许使用JDBC3&nbsp;<tt><span style="font-family:新宋体">PreparedStatement.getGeneratedKeys()</span></tt>&nbsp;来获取数据库生成的key(键)。需要JDBC3+驱动和JRE1.4+, 如果你的数据库驱动在使用Hibernate的标 识生成器时遇到问题，请将此值设为false. 默认情况下将使用连接的元数据来判定驱动的能力.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true|false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.connection.provider_class</span></tt></td>
       <td style="font-size: 12px">自定义<tt><span style="font-family:新宋体">ConnectionProvider</span></tt>的类名, 此类用来向Hibernate提供JDBC连接.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">classname.of.ConnectionProvider</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.connection.isolation</span></tt></td>
       <td style="font-size: 12px">设置JDBC事务隔离级别. 查看<tt><span style="font-family:新宋体">java.sql.Connection</span></tt>来了解各个值的具体意义, 但请注意多数数据库都不支持所有的隔离级别.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">1, 2, 4, 8</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.connection.autocommit</span></tt></td>
       <td style="font-size: 12px">允许被缓存的JDBC连接开启自动提交(autocommit) (不建议).&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.connection.release_mode</span></tt></td>
       <td style="font-size: 12px">指定Hibernate在何时释放JDBC连接. 默认情况下,直到Session被显式关闭或被断开连接时,才会释放JDBC连接. 对于应用程序服务器的JTA数据源, 你应当使用<tt><span style="font-family:新宋体">after_statement</span></tt>, 这样在每次JDBC调用后，都会主动的释放连接. 对于非JTA的连接, 使用<tt><span style="font-family:新宋体">after_transaction</span></tt>在每个事务结束时释放连接是合理的.&nbsp;<tt><span style="font-family:新宋体">auto</span></tt>将为JTA和CMT事务策略选择<tt><span style="font-family:新宋体">after_statement</span></tt>, 为JDBC事务策略选择<tt><span style="font-family:新宋体">after_transaction</span></tt>.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">on_close</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">after_transaction</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">after_statement</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">auto</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.connection.<em>&lt;propertyName&gt;</em></span></tt></td>
       <td style="font-size: 12px">将JDBC属性<tt><span style="font-family:新宋体">propertyName</span></tt>传递到<tt><span style="font-family:新宋体">DriverManager.getConnection()</span></tt>中去.</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.jndi.<em>&lt;propertyName&gt;</em></span></tt></td>
       <td style="font-size: 12px">将属性<tt><span style="font-family:新宋体">propertyName</span></tt>传递到JNDI&nbsp;<tt><span style="font-family:新宋体">InitialContextFactory</span></tt>中去.</td>
      </tr>
     </tbody>
    </table>
    <p><a></a></p>
    <p><strong>表&nbsp;3.5.&nbsp; Hibernate缓存属性</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.provider_class</span></tt></td>
       <td style="font-size: 12px">自定义的<tt><span style="font-family:新宋体">CacheProvider</span></tt>的类名.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">classname.of.CacheProvider</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.use_minimal_puts</span></tt></td>
       <td style="font-size: 12px">以频繁的读操作为代价, 优化二级缓存来最小化写操作. 在Hibernate3中，这个设置对的集群缓存非常有用, 对集群缓存的实现而言，默认是开启的.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true|false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.use_query_cache</span></tt></td>
       <td style="font-size: 12px">允许查询缓存, 个别查询仍然需要被设置为可缓存的.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true|false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.use_second_level_cache</span></tt></td>
       <td style="font-size: 12px">能用来完全禁止使用二级缓存. 对那些在类的映射定义中指定<tt><span style="font-family:新宋体">&lt;cache&gt;</span></tt>的类，会默认开启二级缓存.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true|false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.query_cache_factory</span></tt></td>
       <td style="font-size: 12px">自定义实现<tt><span style="font-family:新宋体">QueryCache</span></tt>接口的类名, 默认为内建的<tt><span style="font-family:新宋体">StandardQueryCache</span></tt>.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">classname.of.QueryCache</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.region_prefix</span></tt></td>
       <td style="font-size: 12px">二级缓存区域名的前缀.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">prefix</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cache.use_structured_entries</span></tt></td>
       <td style="font-size: 12px">强制Hibernate以更人性化的格式将数据存入二级缓存.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true|false</span></tt></td>
      </tr>
     </tbody>
    </table>
    <p><a></a></p>
    <p><strong>表&nbsp;3.6.&nbsp; Hibernate事务属性</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.transaction.factory_class</span></tt></td>
       <td style="font-size: 12px">一个<tt><span style="font-family:新宋体">TransactionFactory</span></tt>的类名, 用于Hibernate&nbsp;<tt><span style="font-family:新宋体">Transaction</span></tt>&nbsp;API (默认为<tt><span style="font-family:新宋体">JDBCTransactionFactory</span></tt>).&nbsp;取值<tt><span style="font-family:新宋体">classname.of.TransactionFactory</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">jta.UserTransaction</span></tt></td>
       <td style="font-size: 12px">一个JNDI名字，被<tt><span style="font-family:新宋体">JTATransactionFactory</span></tt>用来从应用服务器获取JTA&nbsp;<tt><span style="font-family:新宋体">UserTransaction</span></tt>.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">jndi/composite/name</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.transaction.manager_lookup_class</span></tt></td>
       <td style="font-size: 12px">一个<tt><span style="font-family:新宋体">TransactionManagerLookup</span></tt>的类名 - 当使用JVM级缓存，或在JTA环境中使用hilo生成器的时候需要该类.&nbsp;取值<tt><span style="font-family:新宋体">classname.of.TransactionManagerLookup</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.transaction.flush_before_completion</span></tt></td>
       <td style="font-size: 12px">如果开启, session在事务完成后将被自动清洗(flush)。 现在更好的方法是使用自动session上下文管理。取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.transaction.auto_close_session</span></tt></td>
       <td style="font-size: 12px">如果开启, session在事务完成后将被自动关闭。 现在更好的方法是使用自动session上下文管理。取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
     </tbody>
    </table>
    <p><a></a></p>
    <p><strong>表&nbsp;3.7.&nbsp; 其他属性</strong></p>
    <table style="width: 768px;">
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.current_session_context_class</span></tt></td>
       <td style="font-size: 12px">为"当前"&nbsp;<tt><span style="font-family:新宋体">Session</span></tt>指定一个(自定义的)策略。eg.&nbsp;<tt><span style="font-family:新宋体">jta</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">thread</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">custom.Class</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.query.factory_class</span></tt></td>
       <td style="font-size: 12px">选择HQL解析器的实现.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">org.hibernate.hql.ast.ASTQueryTranslatorFactory</span></tt>&nbsp;or&nbsp;<tt><span style="font-family:新宋体">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.query.substitutions</span></tt></td>
       <td style="font-size: 12px">将Hibernate查询中的符号映射到SQL查询中的符号 (符号可能是函数名或常量名字).&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.hbm2ddl.auto</span></tt></td>
       <td style="font-size: 12px">在<tt><span style="font-family:新宋体">SessionFactory</span></tt>创建时，自动检查数据库结构，或者将数据库schema的DDL导出到数据库. 使用&nbsp;<tt><span style="font-family:新宋体">create-drop</span></tt>时,在显式关闭<tt><span style="font-family:新宋体">SessionFactory</span></tt>时，将drop掉数据库schema.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">validate</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">update</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">create</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">create-drop</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">hibernate.cglib.use_reflection_optimizer</span></tt></td>
       <td style="font-size: 12px">开启CGLIB来替代运行时反射机制(系统级属性). 反射机制有时在除错时比较有用. 注意即使关闭这个优化, Hibernate还是需要CGLIB. 你不能在<tt><span style="font-family:新宋体">hibernate.cfg.xml</span></tt>中设置此属性.&nbsp;取值&nbsp;<tt><span style="font-family:新宋体">true</span></tt>&nbsp;|&nbsp;<tt><span style="font-family:新宋体">false</span></tt></td>
      </tr>
     </tbody>
    </table>
    <h3 style="font-size: 13px;color: rgb(0, 0, 0)"><a></a>3.4.1.&nbsp; SQL方言</h3>
    <p>你应当总是为你的数据库将<tt><span style="font-family:新宋体">hibernate.dialect</span></tt>属性设置成正确的&nbsp;<tt><span style="font-family:新宋体">org.hibernate.dialect.Dialect</span></tt>子类. 如果你指定一种方言, Hibernate将为上面列出的一些属性使用合理的默认值, 为你省去了手工指定它们的功夫.</p>
    <p><a></a></p>
    <p><strong>表&nbsp;3.8.&nbsp; Hibernate SQL方言 (<tt><span style="font-family:新宋体">hibernate.dialect</span></tt>)</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>RDBMS</th>
       <th>方言</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px">DB2</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.DB2Dialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">DB2 AS/400</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.DB2400Dialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">DB2 OS390</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.DB2390Dialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">PostgreSQL</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.PostgreSQLDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.MySQLDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL with InnoDB</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.MySQLInnoDBDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL with MyISAM</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.MySQLMyISAMDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Oracle (any version)</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.OracleDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Oracle 9i/10g</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.Oracle9Dialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Sybase</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.SybaseDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Sybase Anywhere</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.SybaseAnywhereDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Microsoft SQL Server</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.SQLServerDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">SAP DB</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.SAPDBDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Informix</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.InformixDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">HypersonicSQL</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.HSQLDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Ingres</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.IngresDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Progress</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.ProgressDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Mckoi SQL</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.MckoiDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Interbase</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.InterbaseDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Pointbase</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.PointbaseDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">FrontBase</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.FrontbaseDialect</span></tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Firebird</td>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.dialect.FirebirdDialect</span></tt></td>
      </tr>
     </tbody>
    </table>
    <p><strong>表&nbsp;3.9.&nbsp; Hibernate日志类别</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>类别</th>
       <th>功能</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.SQL</span></tt></td>
       <td style="font-size: 12px">在所有SQL DML语句被执行时为它们记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.type</span></tt></td>
       <td style="font-size: 12px">为所有JDBC参数记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.tool.hbm2ddl</span></tt></td>
       <td style="font-size: 12px">在所有SQL DDL语句执行时为它们记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.pretty</span></tt></td>
       <td style="font-size: 12px">在session清洗(flush)时，为所有与其关联的实体(最多20个)的状态记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.cache</span></tt></td>
       <td style="font-size: 12px">为所有二级缓存的活动记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction</span></tt></td>
       <td style="font-size: 12px">为事务相关的活动记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.jdbc</span></tt></td>
       <td style="font-size: 12px">为所有JDBC资源的获取记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.hql.AST</span></tt></td>
       <td style="font-size: 12px">在解析查询的时候,记录HQL和SQL的AST分析日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.secure</span></tt></td>
       <td style="font-size: 12px">为JAAS认证请求做日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate</span></tt></td>
       <td style="font-size: 12px">为任何Hibernate相关信息做日志 (信息量较大, 但对查错非常有帮助)</td>
      </tr>
     </tbody>
    </table>
    <p><strong>表&nbsp;3.10.&nbsp;JTA TransactionManagers</strong></p>
    <table>
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>Transaction工厂类</th>
       <th>应用程序服务器</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.JBossTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">JBoss</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.WeblogicTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">Weblogic</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.WebSphereTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">WebSphere</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</span></tt></td>
       <td style="font-size: 12px">WebSphere 6</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.OrionTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">Orion</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.ResinTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">Resin</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.JOTMTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">JOTM</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.JOnASTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">JOnAS</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.JRun4TransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">JRun4</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt><span style="font-family:新宋体">org.hibernate.transaction.BESTransactionManagerLookup</span></tt></td>
       <td style="font-size: 12px">Borland ES</td>
      </tr>
     </tbody>
    </table>
    <p><br>posted on 2008-04-22 18:28&nbsp;<a href="http://www.blogjava.net/i369/" style="color: rgb(68, 68, 68)">芦苇</a>&nbsp;阅读(50570)&nbsp;<a href="http://www.blogjava.net/i369/articles/194855.html#Post" style="color: rgb(68, 68, 68)">评论(1)</a>&nbsp;&nbsp;<a href="http://www.blogjava.net/i369/admin/EditArticles.aspx?postid=194855" style="color: rgb(68, 68, 68)">编辑</a>&nbsp;&nbsp;<a href="http://www.blogjava.net/i369/AddToFavorite.aspx?id=194855" style="color: rgb(68, 68, 68)">收藏</a>&nbsp;所属分类:&nbsp;<a href="http://www.blogjava.net/i369/category/18312.html" style="color: rgb(68, 68, 68)">Hibernate</a><img src="http://www.blogjava.net/i369/aggbug/194855.html?webview=1" width="1" height="1"><a></a><a></a></p>
    <h3 style="font-size: 13px">Feedback</h3>
    <p><a title="permalink: re: Hibernate 参数设置一览表" href="http://www.blogjava.net/i369/articles/194855.html#234281" style="color: rgb(0, 0, 0)">#</a>&nbsp;<a></a>re: Hibernate 参数设置一览表<a></a>&nbsp;2008-10-14 18:13&nbsp;<a href="http://www.blogjava.net/i369/" target="_blank" style="color: rgb(0, 0, 0)">芦苇</a></p>
    <h3 style="font-size: 13px;color: rgb(0, 0, 0)">SQL方言</h3>
    <p><strong>1、Hibernate JDBC属性</strong>&nbsp;<br><br></p>
    <table>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.driver_class</tt></td>
       <td style="font-size: 12px"><em>jdbc驱动类</em></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.url</tt></td>
       <td style="font-size: 12px"><em>jdbc URL</em></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.username</tt></td>
       <td style="font-size: 12px"><em>数据库用户</em></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.password</tt></td>
       <td style="font-size: 12px"><em>数据库用户密码</em></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.pool_size</tt></td>
       <td style="font-size: 12px"><em>连接池容量上限数目</em></td>
      </tr>
     </tbody>
    </table>
    <p>注：使用C3P0的properties样例代码：<br><span style="color: rgb(0, 0, 0)">hibernate.connection.driver_class&nbsp;=&nbsp;org.postgresql.Driver<br>hibernate.connection.url&nbsp;=&nbsp;jdbc:postgresql://localhost/mydatabase<br>hibernate.connection.username&nbsp;=&nbsp;myuser<br>hibernate.connection.password&nbsp;=&nbsp;secret<br>hibernate.c3p0.min_size=5<br>hibernate.c3p0.max_size=20<br>hibernate.c3p0.timeout=1800<br>hibernate.c3p0.max_statements=50<br>hibernate.dialect&nbsp;=&nbsp;org.hibernate.dialect.PostgreSQLDialect</span><br><strong>2、Hibernate的数据源属性</strong><br></p>
    <table width="544">
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.datasource</tt></td>
       <td style="font-size: 12px"><em>数据源JNDI名字</em></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jndi.url</tt></td>
       <td style="font-size: 12px"><em>JNDI提供者的URL</em>&nbsp;(可选)</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jndi.class</tt></td>
       <td style="font-size: 12px"><em>JNDI&nbsp;<tt>InitialContextFactory</tt>类</em>&nbsp;(可选)</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.username</tt></td>
       <td style="font-size: 12px"><em>数据库用户</em>&nbsp;(可选)</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.password</tt></td>
       <td style="font-size: 12px"><em>数据库用户密码</em>&nbsp;(可选)</td>
      </tr>
     </tbody>
    </table>
    <p>注：应用程序服务器JNDI数据源的<tt>hibernate.properties</tt>样例代码：<br><span style="color: rgb(0, 0, 0)">hibernate.connection.datasource&nbsp;=&nbsp;java:/comp/env/jdbc/test<br>hibernate.transaction.factory_class&nbsp;=&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;org.hibernate.transaction.JTATransactionFactory<br>hibernate.transaction.manager_lookup_class&nbsp;=&nbsp;\<br>&nbsp;&nbsp;&nbsp;&nbsp;org.hibernate.transaction.JBossTransactionManagerLookup<br>hibernate.dialect&nbsp;=&nbsp;org.hibernate.dialect.PostgreSQLDialect</span><br>3、<strong>Hibernate配置属性（可选）</strong><br></p>
    <table width="745">
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.dialect</tt></td>
       <td style="font-size: 12px">一个Hibernate&nbsp;<tt>Dialect</tt>类名允许Hibernate针对特定的关系数据库生成优化的SQL.<p>取值<tt>full.classname.of.Dialect</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.show_sql</tt></td>
       <td style="font-size: 12px">输出所有SQL语句到控制台.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.format_sql</tt></td>
       <td style="font-size: 12px">在log和console中打印出更漂亮的sql.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.default_schema</tt></td>
       <td style="font-size: 12px">在生成的SQL中, 将给定的schema/tablespace附加于非全限定名的表名上.<p>取值<tt>SCHEMA_NAME</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.default_catalog</tt></td>
       <td style="font-size: 12px">在生成的SQL中, 将给定的catalog附加于没全限定名的表名上.<p>取值<tt>CATALOG_NAME</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.session_factory_name</tt></td>
       <td style="font-size: 12px"><tt>SessionFactory</tt>创建后，将自动使用这个名字绑定到JNDI中.<p>取值<tt>jndi/composite/name</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.max_fetch_depth</tt></td>
       <td style="font-size: 12px">为单向关联(一对一, 多对一)的外连接抓取（outer join fetch）树设置最大深度. 值为<tt>0</tt>意味着将关闭默认的外连接抓取.<p>取值&nbsp;建议在<tt>0</tt>到<tt>3</tt>之间取值</p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.default_batch_fetch_size</tt></td>
       <td style="font-size: 12px">为Hibernate关联的批量抓取设置默认数量.<p>取值&nbsp;建议的取值为<tt>4</tt>,&nbsp;<tt>8</tt>, 和<tt>16</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.default_entity_mode</tt></td>
       <td style="font-size: 12px">为由这个<tt>SessionFactory</tt>打开的所有Session指定默认的实体表现模式.<p>取值<tt>dynamic-map</tt>,&nbsp;<tt>dom4j</tt>,&nbsp;<tt>pojo</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.order_updates</tt></td>
       <td style="font-size: 12px">强制Hibernate按照被更新数据的主键，为SQL更新排序。这么做将减少在高并发系统中事务的死锁。<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.generate_statistics</tt></td>
       <td style="font-size: 12px">如果开启, Hibernate将收集有助于性能调节的统计数据.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.use_identifer_rollback</tt></td>
       <td style="font-size: 12px">如果开启, 在对象被删除时生成的标识属性将被重设为默认值.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.use_sql_comments</tt></td>
       <td style="font-size: 12px">如果开启, Hibernate将在SQL中生成有助于调试的注释信息, 默认值为<tt>false</tt>.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
     </tbody>
    </table>
    <p><br>4、<strong>Hibernate JDBC和连接(connection)属性<br></strong></p>
    <table>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.fetch_size</tt></td>
       <td style="font-size: 12px">非零值，指定JDBC抓取数量的大小 (调用<tt>Statement.setFetchSize()</tt>).</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.batch_size</tt></td>
       <td style="font-size: 12px">非零值，允许Hibernate使用JDBC2的批量更新.<p>取值&nbsp;建议取<tt>5</tt>到<tt>30</tt>之间的值</p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.batch_versioned_data</tt></td>
       <td style="font-size: 12px">如果你想让你的JDBC驱动从<tt>executeBatch()</tt>返回正确的行计数 , 那么将此属性设为<tt>true</tt>(开启这个选项通常是安全的). 同时，Hibernate将为自动版本化的数据使用批量DML. 默认值为<tt>false</tt>.<p>eg.<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.factory_class</tt></td>
       <td style="font-size: 12px">选择一个自定义的<tt>Batcher</tt>. 多数应用程序不需要这个配置属性.<p>eg.<tt>classname.of.Batcher</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.use_scrollable_resultset</tt></td>
       <td style="font-size: 12px">允许Hibernate使用JDBC2的可滚动结果集. 只有在使用用户提供的JDBC连接时，这个选项才是必要的, 否则Hibernate会使用连接的元数据.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.use_streams_for_binary</tt></td>
       <td style="font-size: 12px">在JDBC读写<tt>binary (二进制)</tt>或<tt>serializable (可序列化)</tt>&nbsp;的类型时使用流(stream)(系统级属性).<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jdbc.use_get_generated_keys</tt></td>
       <td style="font-size: 12px">在数据插入数据库之后，允许使用JDBC3&nbsp;<tt>PreparedStatement.getGeneratedKeys()</tt>&nbsp;来获取数据库生成的key(键)。需要JDBC3+驱动和JRE1.4+, 如果你的数据库驱动在使用Hibernate的标 识生成器时遇到问题，请将此值设为false. 默认情况下将使用连接的元数据来判定驱动的能力.<p>取值<tt>true|false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.provider_class</tt></td>
       <td style="font-size: 12px">自定义<tt>ConnectionProvider</tt>的类名, 此类用来向Hibernate提供JDBC连接.<p>取值<tt>classname.of.ConnectionProvider</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.isolation</tt></td>
       <td style="font-size: 12px">设置JDBC事务隔离级别. 查看<tt>java.sql.Connection</tt>来了解各个值的具体意义, 但请注意多数数据库都不支持所有的隔离级别.<p>取值<tt>1, 2, 4, 8</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.autocommit</tt></td>
       <td style="font-size: 12px">允许被缓存的JDBC连接开启自动提交(autocommit) (不建议).<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.release_mode</tt></td>
       <td style="font-size: 12px">指定Hibernate在何时释放JDBC连接. 默认情况下,直到Session被显式关闭或被断开连接时,才会释放JDBC连接. 对于应用程序服务器的JTA数据源, 你应当使用<tt>after_statement</tt>, 这样在每次JDBC调用后，都会主动的释放连接. 对于非JTA的连接, 使用<tt>after_transaction</tt>在每个事务结束时释放连接是合理的.&nbsp;<tt>auto</tt>将为JTA和CMT事务策略选择<tt>after_statement</tt>, 为JDBC事务策略选择<tt>after_transaction</tt>.<p>取值<tt>on_close</tt>&nbsp;|&nbsp;<tt>after_transaction</tt>&nbsp;|&nbsp;<tt>after_statement</tt>&nbsp;|&nbsp;<tt>auto</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.connection.<em>&lt;propertyName&gt;</em></tt></td>
       <td style="font-size: 12px">将JDBC属性<tt>propertyName</tt>传递到<tt>DriverManager.getConnection()</tt>中去.</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.jndi.<em>&lt;propertyName&gt;</em></tt></td>
       <td style="font-size: 12px">将属性<tt>propertyName</tt>传递到JNDI&nbsp;<tt>InitialContextFactory</tt>中去.</td>
      </tr>
     </tbody>
    </table>
    <p><br><strong>5、Hibernate缓存属性<br></strong></p>
    <table>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.provider_class</tt></td>
       <td style="font-size: 12px">自定义的<tt>CacheProvider</tt>的类名.<p>取值<tt>classname.of.CacheProvider</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.use_minimal_puts</tt></td>
       <td style="font-size: 12px">以频繁的读操作为代价, 优化二级缓存来最小化写操作. 在Hibernate3中，这个设置对的集群缓存非常有用, 对集群缓存的实现而言，默认是开启的.<p>取值<tt>true|false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.use_query_cache</tt></td>
       <td style="font-size: 12px">允许查询缓存, 个别查询仍然需要被设置为可缓存的.<p>取值<tt>true|false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.use_second_level_cache</tt></td>
       <td style="font-size: 12px">能用来完全禁止使用二级缓存. 对那些在类的映射定义中指定<tt>&lt;cache&gt;</tt>的类，会默认开启二级缓存.<p>取值<tt>true|false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.query_cache_factory</tt></td>
       <td style="font-size: 12px">自定义的实现<tt>QueryCache</tt>接口的类名, 默认为内建的<tt>StandardQueryCache</tt>.<p>取值<tt>classname.of.QueryCache</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.region_prefix</tt></td>
       <td style="font-size: 12px">二级缓存区域名的前缀.<p>取值<tt>prefix</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cache.use_structured_entries</tt></td>
       <td style="font-size: 12px">强制Hibernate以更人性化的格式将数据存入二级缓存.<p>取值<tt>true|false</tt></p></td>
      </tr>
     </tbody>
    </table>
    <p><br>6、<strong>Hibernate事务属性<br></strong></p>
    <table>
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.transaction.factory_class</tt></td>
       <td style="font-size: 12px">一个<tt>TransactionFactory</tt>的类名, 用于Hibernate&nbsp;<tt>Transaction</tt>&nbsp;API (默认为<tt>JDBCTransactionFactory</tt>).<p>取值<tt>classname.of.TransactionFactory</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>jta.UserTransaction</tt></td>
       <td style="font-size: 12px">一个JNDI名字，被<tt>JTATransactionFactory</tt>用来从应用服务器获取JTA&nbsp;<tt>UserTransaction</tt>.<p>取值<tt>jndi/composite/name</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.transaction.manager_lookup_class</tt></td>
       <td style="font-size: 12px">一个<tt>TransactionManagerLookup</tt>的类名 - 当使用JVM级缓存，或在JTA环境中使用hilo生成器的时候需要该类.<p>取值<tt>classname.of.TransactionManagerLookup</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.transaction.flush_before_completion</tt></td>
       <td style="font-size: 12px">如果开启, session在事务完成后将被自动清洗(flush). (在Hibernate和CMT一起使用时很有用.)<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.transaction.auto_close_session</tt></td>
       <td style="font-size: 12px">如果开启, session在事务完成前将被自动关闭. (在Hibernate和CMT一起使用时很有用.)<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
     </tbody>
    </table>
    <p><br>7、<strong>其他属性<br></strong></p>
    <table style="width: 768px;">
     <thead>
      <tr class="firstRow">
       <th>属性名</th>
       <th>用途</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.query.factory_class</tt></td>
       <td style="font-size: 12px">选择HQL解析器的实现.<p>取值<tt>org.hibernate.hql.ast.ASTQueryTranslatorFactory</tt>&nbsp;or&nbsp;<tt>org.hibernate.hql.classic.ClassicQueryTranslatorFactory</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.query.substitutions</tt></td>
       <td style="font-size: 12px">将Hibernate查询中的符号映射到SQL查询中的符号 (符号可能是函数名或常量名字).<p>取值<tt>hqlLiteral=SQL_LITERAL, hqlFunction=SQLFUNC</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.hbm2ddl.auto</tt></td>
       <td style="font-size: 12px">在<tt>SessionFactory</tt>创建时，自动将数据库schema的DDL导出到数据库. 使用&nbsp;<tt>create-drop</tt>时,在显式关闭<tt>SessionFactory</tt>时，将drop掉数据库schema.<p>取值<tt>update</tt>&nbsp;|&nbsp;<tt>create</tt>&nbsp;|&nbsp;<tt>create-drop</tt></p></td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>hibernate.cglib.use_reflection_optimizer</tt></td>
       <td style="font-size: 12px">开启CGLIB来替代运行时反射机制(系统级属性). 反射机制有时在除错时比较有用. 注意即使关闭这个优化, Hibernate还是需要CGLIB. 你不能在<tt>hibernate.cfg.xml</tt>中设置此属性.<p>取值<tt>true</tt>&nbsp;|&nbsp;<tt>false</tt></p></td>
      </tr>
     </tbody>
    </table>
    <p><br>8、<strong>SQL方言<br></strong><strong>&nbsp;&nbsp; Hibernate SQL方言 (<tt>hibernate.dialect</tt>)</strong></p>
    <table width="520">
     <colgroup>
      <col>
      <col>
     </colgroup>
     <thead>
      <tr class="firstRow">
       <th>RDBMS</th>
       <th>方言</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px">DB2</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.DB2Dialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">DB2 AS/400</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.DB2400Dialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">DB2 OS390</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.DB2390Dialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">PostgreSQL</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.PostgreSQLDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.MySQLDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL with InnoDB</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.MySQLInnoDBDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">MySQL with MyISAM</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.MySQLMyISAMDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Oracle (any version)</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.OracleDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Oracle 9i/10g</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.Oracle9Dialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Sybase</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.SybaseDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Sybase Anywhere</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.SybaseAnywhereDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Microsoft SQL Server</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.SQLServerDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">SAP DB</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.SAPDBDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Informix</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.InformixDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">HypersonicSQL</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.HSQLDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Ingres</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.IngresDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Progress</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.ProgressDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Mckoi SQL</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.MckoiDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Interbase</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.InterbaseDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Pointbase</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.PointbaseDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">FrontBase</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.FrontbaseDialect</tt></td>
      </tr>
      <tr>
       <td style="font-size: 12px">Firebird</td>
       <td style="font-size: 12px"><tt>org.hibernate.dialect.FirebirdDialect</tt></td>
      </tr>
     </tbody>
    </table>
    <p><br>9、<strong>Hibernate日志类别<br></strong></p>
    <table width="745">
     <thead>
      <tr class="firstRow">
       <th>类别</th>
       <th>功能</th>
      </tr>
     </thead>
     <tbody>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.SQL</tt></td>
       <td style="font-size: 12px">在所有SQL DML语句被执行时为它们记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.type</tt></td>
       <td style="font-size: 12px">为所有JDBC参数记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.tool.hbm2ddl</tt></td>
       <td style="font-size: 12px">在所有SQL DDL语句执行时为它们记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.pretty</tt></td>
       <td style="font-size: 12px">在session清洗(flush)时，为所有与其关联的实体(最多20个)的状态记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.cache</tt></td>
       <td style="font-size: 12px">为所有二级缓存的活动记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.transaction</tt></td>
       <td style="font-size: 12px">为事务相关的活动记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.jdbc</tt></td>
       <td style="font-size: 12px">为所有JDBC资源的获取记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.hql.ast</tt></td>
       <td style="font-size: 12px">为HQL和SQL的自动状态转换和其他关于查询解析的信息记录日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate.secure</tt></td>
       <td style="font-size: 12px">为JAAS认证请求做日志</td>
      </tr>
      <tr>
       <td style="font-size: 12px"><tt>org.hibernate</tt></td>
       <td style="font-size: 12px">为任何Hibernate相关信息做日志 (信息量较大, 但对查错非常有帮助)<br><br></td>
      </tr>
     </tbody>
    </table>
    <p><br></p>
   </div> 
  </div>  
 </body>
</html>